Skip to content

Updates from Acepe session#213

Merged
flazouh merged 3 commits into
mainfrom
acepe/20260618-121415
Jun 19, 2026
Merged

Updates from Acepe session#213
flazouh merged 3 commits into
mainfrom
acepe/20260618-121415

Conversation

@flazouh

@flazouh flazouh commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Created with Acepe


Summary by cubic

Polishes the assistant Thinking experience with a streaming header and smoother token reveal, stabilizes first‑connect session identity/sequence, and upgrades dead‑code tooling for safer cleanup. Also removes orphan UI renderers and fixes pending model/deferred bind edge cases.

  • New Features

    • Thought UI polish: show a Thinking header while streaming and apply token‑reveal timing to thought groups; restore a smooth cascade by setting TOKEN_REVEAL_STEP_MS to 48ms (packages/ui, packages/desktop).
    • Toolbar model UX: prefer an explicit provisional model pick during connect via resolveResolvableToolbarModelId, and use it in the composer toolbar (packages/desktop).
    • Earlier, stable sequence IDs: show the sequence id in the panel header from pending creation and backfill metadata from the state graph or pending creation (session-sequence-id-backfill, store/applier updates).
    • Session list resiliency: fall back to a path‑derived project name/color so pending badges render before the color map hydrates.
    • Dead‑code tooling: add scripts/dead-code/apply-dead-code.ts with dry‑run and --apply (delete) modes plus optional --include-barrel-only; detect export-barrel-only by following named imports through re‑export chains; remove unused agent-input-slash-command-section.svelte and the legacy desktop AssistantMessage export.
  • Bug Fixes

    • Clear pending_model_id when the capability catalog is empty in the cc_sdk_client; adds test coverage.
    • Fail closed when a deferred bind’s creation attempt is missing via require_creation_attempt_for_deferred_bind; adds tests.
    • Allocate a sequence id when promoting legacy creation attempts with a null sequence; adds repository test.

Written for commit 7ec96dc. Summary will update on new commits.

Review in cubic

flazouh and others added 2 commits June 18, 2026 01:40
…ooling

Show the thinking header while streaming, wire token reveal into thought
groups, and restore TOKEN_REVEAL_STEP_MS so main-body text cascades smoothly
again. Extend the dead-code analyzer with export-barrel-only detection and
an opt-in apply script for high-confidence deletions.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 39 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/dead-code/apply-dead-code.ts">

<violation number="1" location="scripts/dead-code/apply-dead-code.ts:22">
P2: `--root` parsing consumes the next token even when it is another flag. Missing root value can silently disable `--apply`/other flags and point analysis at an invalid path.</violation>
</file>

<file name="package.json">

<violation number="1" location="package.json:17">
P2: Misleading name: `dead-code:apply` does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. `dead-code:dry-run`) and reserve `dead-code:apply` for the actual deletion.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === "--root") {
repoRoot = argv[index + 1] ?? repoRoot;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: --root parsing consumes the next token even when it is another flag. Missing root value can silently disable --apply/other flags and point analysis at an invalid path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/dead-code/apply-dead-code.ts, line 22:

<comment>`--root` parsing consumes the next token even when it is another flag. Missing root value can silently disable `--apply`/other flags and point analysis at an invalid path.</comment>

<file context>
@@ -0,0 +1,109 @@
+	for (let index = 0; index < argv.length; index += 1) {
+		const arg = argv[index];
+		if (arg === "--root") {
+			repoRoot = argv[index + 1] ?? repoRoot;
+			index += 1;
+			continue;
</file context>

Comment thread package.json
"scripts": {
"audit": "bun audit --audit-level high",
"check:dead-code": "bun scripts/dead-code/find-dead-code.ts --strict",
"dead-code:apply": "bun scripts/dead-code/apply-dead-code.ts",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Misleading name: dead-code:apply does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. dead-code:dry-run) and reserve dead-code:apply for the actual deletion.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 17:

<comment>Misleading name: `dead-code:apply` does a dry-run, not an apply. Rename to signal dry-run behavior (e.g. `dead-code:dry-run`) and reserve `dead-code:apply` for the actual deletion.</comment>

<file context>
@@ -14,6 +14,8 @@
 	"scripts": {
 		"audit": "bun audit --audit-level high",
 		"check:dead-code": "bun scripts/dead-code/find-dead-code.ts --strict",
+		"dead-code:apply": "bun scripts/dead-code/apply-dead-code.ts",
+		"dead-code:apply:force": "bun scripts/dead-code/apply-dead-code.ts --apply",
 		"test": "bun scripts/forbid-structural-tests.ts packages && bun run --cwd packages/ui test && bun run --cwd packages/desktop test && bun run --cwd packages/website test"
</file context>

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR bundles several improvements around session identity stability during first connect, thinking-block UI polish, and safe dead-code cleanup tooling. Backend changes harden two edge cases (stale pending_model_id and missing creation-attempt rows on deferred bind), while the frontend wires pending-creation sequence IDs earlier into the panel header and session list so the UI has a stable identity before metadata arrives.

  • Thinking block overhaul (packages/ui): always shows the Thinking header during streaming, derives collapse state reactively off the streaming edge (so it auto-collapses when streaming ends unless the user toggled it), and applies the same token-reveal timing to the last thought group.
  • Sequence ID backfill (session-sequence-id-backfill.ts, panel-agent-state, agent-panel.svelte): exposes pending-creation sequenceId through a new getPendingCreationSession delegation chain and resolves it as a fallback when session metadata hasn't arrived yet.
  • Dead-code tooling (scripts/dead-code): adds barrel-only candidate detection to find-dead-code and a new apply-dead-code CLI with dry-run by default and --apply opt-in for deletion.

Confidence Score: 5/5

Safe to merge — all changed paths are either additive (new helpers, tests, tooling) or tighten existing behavior in the correct direction.

The Rust backend changes fail-closed and are covered by dedicated tests. The TypeScript store delegation chain for getPendingCreationSession follows the same pattern already used for hasPendingCreationSession. The thinking-block collapse refactor is well-tested with new vitest coverage. The dead-code tooling is a developer-only script with a dry-run default and no production code path.

The barrel re-export tracing logic in scripts/dead-code/find-dead-code.ts has two small code-quality issues worth cleaning up before the tool produces unexpected results.

Important Files Changed

Filename Overview
scripts/dead-code/find-dead-code.ts Adds export-barrel-only candidate detection via barrel re-export tracing. One dead branch in resolveReexportTarget (both arms return the same value) may over-populate barrelConsumed and hide valid candidates; separately, dead regex code in parseImportNames after an earlier continue guard.
scripts/dead-code/apply-dead-code.ts New dry-run/apply CLI for dead-code deletion. Safe default (dry-run) and opt-in --apply guard; unlinkSync is properly scoped to repo-relative resolved paths.
packages/desktop/src-tauri/src/acp/commands/session_commands/new_session.rs Adds require_creation_attempt_for_deferred_bind to fail-closed when a deferred bind's creation row is missing, replacing a silent Option unwrap with a proper error. Tests cover both the happy path and the missing-attempt case.
packages/desktop/src-tauri/src/acp/client/cc_sdk_client/mod.rs Clears pending_model_id when the capability catalog is empty, preventing a stale model from persisting across reconnects. Test coverage added.
packages/desktop/src/lib/acp/store/session-sequence-id-backfill.ts New utility that resolves the sequence ID backfill priority: metadata wins, then graph, then pending creation. Logic is simple and well-tested.
packages/desktop/src/lib/acp/store/session-open-snapshot-applier.svelte.ts Adds syncSessionSequenceFromPendingCreation called before completePendingCreation, ensuring the sequence ID is backfilled from either the graph or pending creation before the pending state is cleared.
packages/ui/src/components/agent-panel/agent-assistant-message.svelte Refactors thinking-block collapse to use a derived isCollapsed driven by streaming state, and shows the Thinking header unconditionally while streaming. Token-reveal timing is now applied to the last thought group during streaming.
packages/desktop/src/lib/acp/components/agent-panel/logic/agent-panel-header-sequence-id.ts New logic function resolving panel header sequence ID from metadata, falling back to pending creation sequence when metadata isn't yet populated.
packages/desktop/src/lib/acp/components/messages/assistant-message.svelte Deleted (dead code cleanup) — replaced by the shared component in packages/ui.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Panel as agent-panel.svelte
    participant Store as SessionStore
    participant Facade as SessionConnectionFacade
    participant Coord as SessionCreationCoordinator
    participant Applier as SessionOpenSnapshotApplier
    participant Backfill as session-sequence-id-backfill

    Note over Panel,Coord: Before session metadata arrives (pending state)
    Panel->>Store: getPendingCreationSession(id)
    Store->>Facade: getPendingCreationSession(id)
    Facade->>Coord: getPendingCreation(id)
    Coord-->>Panel: "{ sequenceId: N }"
    Panel->>Panel: resolveAgentPanelHeaderSequenceId()

    Note over Applier,Backfill: On snapshot open (session connects)
    Applier->>Applier: syncSessionSequenceFromGraph(graph)
    Applier->>Backfill: resolveSequenceIdBackfillForExistingSession()
    Backfill-->>Applier: graphSequenceId ?? pendingSequenceId
    Applier->>Store: "updateSession(sessionId, { sequenceId })"
    Applier->>Coord: completePendingCreation(sessionId)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Panel as agent-panel.svelte
    participant Store as SessionStore
    participant Facade as SessionConnectionFacade
    participant Coord as SessionCreationCoordinator
    participant Applier as SessionOpenSnapshotApplier
    participant Backfill as session-sequence-id-backfill

    Note over Panel,Coord: Before session metadata arrives (pending state)
    Panel->>Store: getPendingCreationSession(id)
    Store->>Facade: getPendingCreationSession(id)
    Facade->>Coord: getPendingCreation(id)
    Coord-->>Panel: "{ sequenceId: N }"
    Panel->>Panel: resolveAgentPanelHeaderSequenceId()

    Note over Applier,Backfill: On snapshot open (session connects)
    Applier->>Applier: syncSessionSequenceFromGraph(graph)
    Applier->>Backfill: resolveSequenceIdBackfillForExistingSession()
    Backfill-->>Applier: graphSequenceId ?? pendingSequenceId
    Applier->>Store: "updateSession(sessionId, { sequenceId })"
    Applier->>Coord: completePendingCreation(sessionId)
Loading

Fix All in Claude Code Fix All in Cursor Fix All in Codex

Reviews (2): Last reviewed commit: "chore(dead-code): track barrel named imp..." | Re-trigger Greptile

Comment on lines +575 to +580
const pendingCreation = sessionStore.getPendingCreationSession(id);
return resolveAgentPanelHeaderSequenceId({
sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId,
pendingCreationSequenceId: pendingCreation?.sequenceId ?? null,
hasPendingCreationSession: sessionStore.hasPendingCreationSession(id),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 getPendingCreationSession(id) already returns null when there is no pending creation, so calling hasPendingCreationSession(id) separately is redundant — pendingCreation !== null is the exact same check. The two calls also go through separate delegation chains, making them subtly susceptible to diverging if the underlying map is mutated between them.

Suggested change
const pendingCreation = sessionStore.getPendingCreationSession(id);
return resolveAgentPanelHeaderSequenceId({
sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId,
pendingCreationSequenceId: pendingCreation?.sequenceId ?? null,
hasPendingCreationSession: sessionStore.hasPendingCreationSession(id),
});
const pendingCreation = sessionStore.getPendingCreationSession(id);
return resolveAgentPanelHeaderSequenceId({
sessionMetadataSequenceId: sessionController.sessionMetadata?.sequenceId,
pendingCreationSequenceId: pendingCreation?.sequenceId ?? null,
hasPendingCreationSession: pendingCreation !== null,
});

Fix in Claude Code Fix in Cursor Fix in Codex

Resolve export-barrel-only false positives by following named imports through
re-export chains, delete the unreachable slash-command section component, and
remove the superseded desktop AssistantMessage renderer from the messages barrel.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 9 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/dead-code/find-dead-code.ts">

<violation number="1" location="scripts/dead-code/find-dead-code.ts:947">
P2: Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

const token = typePrefix !== null ? typePrefix[1] ?? "" : trimmed;
const asIndex = token.lastIndexOf(" as ");
if (asIndex !== -1) {
names.push(token.slice(asIndex + 4).trim());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/dead-code/find-dead-code.ts, line 947:

<comment>Aliased named imports are resolved with the local alias instead of the exported symbol name. This undercounts barrel consumption and can produce false dead-code classifications.</comment>

<file context>
@@ -899,6 +899,267 @@ export function parseGitPorcelain(output: string): Candidate[] {
+		const token = typePrefix !== null ? typePrefix[1] ?? "" : trimmed;
+		const asIndex = token.lastIndexOf(" as ");
+		if (asIndex !== -1) {
+			names.push(token.slice(asIndex + 4).trim());
+		} else {
+			names.push(token.trim());
</file context>
Suggested change
names.push(token.slice(asIndex + 4).trim());
names.push(token.slice(0, asIndex).trim());

@flazouh flazouh merged commit 7ec96dc into main Jun 19, 2026
4 of 6 checks passed
@flazouh flazouh deleted the acepe/20260618-121415 branch June 19, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant